/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-01-28
 * Time: 8:50
 */
public class practice {

    //3、斐波那契数列
    public static void fibonacciSequence(int n){
        int f1=1;
        int f2=1;
        int f3=1;
        for (int i = 1; i <=n-2 ; i++) {
            f3=f1+f2;
            f1=f2;
            f2=f3;
        }
        System.out.println(f3);
    }

    //2.实现一个两个整数相加的方法
    public static void add(int x,int y){
        System.out.println(x+y);
    }

    //1.实现一个函数，检测一个年份是否为闰年
    public static boolean isLeapYear(int year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
            return true;
        } else {
            return false;
        }
    }

    public static void main(String[] args) {
        boolean ret = isLeapYear(2004);
        if (ret) {
            System.out.println("闰年");
        } else {
            System.out.println("不是闰年");
        }
        int x=1;
        int y=2;
        add(x,y);

        fibonacciSequence(5);
    }
}
